<?php include("connection.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Show Requests</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="val.js"></script>
<script type="text/javascript" src="jquery.tokeninput.js"></script>
<link rel="stylesheet" href="token-input.css" type="text/css" />
<style type="text/css">
<!--
body, td, th {font-family: segoe UI, tahoma, trebuchet MS, verdana;
	font-size: 12px;
	color: #000;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #03C;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #03C;
}
a:hover {
	text-decoration: none;
	color: #03C;
}
a:active {
	text-decoration: none;
	color: #03C;
}
.checkbox {
}
-->
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }



.head {
	color: #999;
}
.head td strong {
	color: #999;
}
</style>

</head>
<body>

<?php
function get_airline_name($str)
{
	$query = mysql_query("SELECT airline_name from airline_new WHERE airline_code='$str' limit 0,1");
	$row=mysql_fetch_array($query);
	if($row[0]!==""){echo "<li>".$row[0]."</li>";};
	
}

function get_option($str)
{
	switch($str)
	{
		case "G":
		echo "<li>Multiple airport</li>";
		break;
		case "H":
		echo "<li>Direct Access</li>";
		break;
		case "I":
		echo "<li>Direct flights</li>";
		break;
		case "K":
		echo "<li>Non Stop Flights</li>";
		break;
		case "L":
		echo "<li>Single connections orbetter</li>";
		break;
		case "N":
		echo "<li>SecuRate only</li>";
		break;
		case "O":
		echo "<li>Flight Service Information</li>";
		break;
		case "G":
		echo "<li>Multiple airport</li>";
		break;
		case "R":
		echo "<li>Exclude Double Connections</li>";
		break;
		case "U":
		echo "<li>Published and Phase I securat</li>";
		break;
		case "V":
		echo "<li>Phase I SecuRate Only</li>";
		break;
	}
}

?>
<table width="1000" border="0" align="center" cellpadding="4" cellspacing="0">
  <tr>
    <td width="394"><strong style="font-size: 16px">Booking Engine</strong></td>
    <td width="335">&nbsp;</td>
    <td width="47">&nbsp;</td>
  </tr>
</table>
<br />
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td height="26" bgcolor="#F3F3F3"><strong>&nbsp;&nbsp;&raquo; Showing Request of Config id-&gt; <span style=" color:#090"><?php echo $_REQUEST['config_id']; ?></span></strong></td>
  </tr>
  <tr>
    <td><table width="1000" border="0" cellspacing="1" cellpadding="4">
      <tr class="head">
        <td bgcolor="#F8F8F8"><strong>ID</strong></td>
        <td bgcolor="#F8F8F8"><strong>Options</strong></td>
        <td bgcolor="#F8F8F8"><strong>PTC</strong></td>
        <td bgcolor="#F8F8F8"><strong>Include Airlines</strong></td>
        <td bgcolor="#F8F8F8"><strong>Excluded Airlines</strong></td>
        <td bgcolor="#F8F8F8"><strong>Sid</strong></td>
        <td bgcolor="#F8F8F8"><strong>ALT</strong></td>
        <td bgcolor="#F8F8F8"><strong>Status</strong></td>
        <td bgcolor="#F8F8F8"><strong>Edit</strong></td>
        <td bgcolor="#F8F8F8"><strong>Test Req</strong></td>
      </tr>
      <?php
	  $config=$_REQUEST['config_id'];
      	$q=mysql_query("SELECT * FROM requests where config_id='$config'");
		$num=mysql_num_rows($q);
		if($num=="0")
		{
			echo "<tr ><td colspan='10'  bgcolor='#F8F8F8' align='center'> <span style='color:red;'>No Requests Created.</span> </td></tr>"	;
		
		}
		else{
		$i=0;
		while($row=mysql_fetch_array($q))
		{
			$i++;
      ?>
      <tr>
        <td width="31" bgcolor="#F8F8F8"><?php echo $i;?></td>
        <td width="193" bgcolor="#F8F8F8"><?php 
		
		$opt=explode(",",$row['options']);get_option($opt[0]);get_option($opt[1]);get_option($opt[2]);
		
		
		?>
        
        &nbsp;</td>
        <td width="96" bgcolor="#F8F8F8"><?php echo $row['ptc'];?>&nbsp;</td>
        <td width="157" bgcolor="#F8F8F8">
		
		<?php
        $a=explode(",",$row['inc_arl']);
		if($row['inc_arl']!==""){foreach($a as $b){get_airline_name($b);}}
        ?>&nbsp;
        </td>
        <td width="173" bgcolor="#F8F8F8">	<?php
        $c=explode(",",$row['exc_arl']);
		if($row['exc_arl']!==""){foreach($c as $d){get_airline_name($d);}}
        ?>&nbsp;</td>
        <td width="42" bgcolor="#F8F8F8"><?php echo $row['sid'];?>&nbsp;</td>
        <td width="47" bgcolor="#F8F8F8"><?php echo $row['num_alt'];?>&nbsp;</td>
        <td width="56" bgcolor="#F8F8F8"><?php echo ($row['status']=="1")?"<span style='color:green;'>Active</span>":"<span style='color:red;'>Paused</span>";?>&nbsp;</td>
        <td width="39" bgcolor="#F8F8F8">
        	<a href="update_request.php?request_id=<?php echo $row['idRequests'];?>&config_id=<?php echo $row['config_id'];?>"> <strong>Edit</strong></a><strong>&nbsp;</strong></td>
        <td width="75" bgcolor="#F8F8F8"><a href="view_req.php?request_id=<?php echo $row['idRequests'];?>&config_id=<?php echo $row['config_id'];?>">View</a></td>
      </tr>
      <?php
		}
		}
		?>
    </table></td>
  </tr>
  <tr>
<td height="24" bgcolor="#F3F3F3"><strong>&nbsp;&nbsp;<a href="create_request.php?config_id=<?php echo $_REQUEST['config_id'];?>"> &raquo;  Add New Request </a>&nbsp;&nbsp;<a href="index.php"> &raquo;  Show All Configuration</a></strong></td>
  </tr>
</table>



</body>
<?php
mysql_close($con);
?>
</html>
